// pages/app/activities/index/index.js
const app = getApp();
var host = app.globalData.host;
var utils = app.globalData.utils;
var self = null;

Page({
  data: {
    themeColor: '',
    themeColor2: '',
    themeColor3: '',
    defaultColor: '',
    borderColor: '',
    list: []
  },
  onLoad: function (options) {
    self = this;
    self.getStyle();
  },
  onShow: function () {
    self.init();
  },
  getStyle() {
    self.setData({
      themeColor: app.globalData.themeColor,
      themeColor2: app.globalData.themeColor2,
      themeColor3: app.globalData.themeColor3,
      defaultColor: app.globalData.defaultColor,
      borderColor: app.globalData.borderColor
    })
  },
  init() {
    var url = host + '/lx/mini/activity/list';
    var params = {};
    var success = function (res) {
      self.setData({
        list: res.info.list
      })
    }
    var fail = function () { };
    var complete = function () { };
    utils.request(url, params, success, fail, complete);
  },
  goInfo(event) {
    var id = event.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/pages/app/activities/activityInfo/activityInfo?id=' + id
    })
  }
})